﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;

namespace Root.Controllers
{
    public class BlogController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.msg = "";
            if (Request["IsPost"] == "true")
            {
                string path = Request["path"];
                if (path == "")
                {
                    Response.Write(@"<script>javascript:alert('未输入路径');</script>");
                    return View();
                }
                if (Directory.Exists(@"F:\Root\Files\Blog\" + path))
                {
                    Response.Write(@"<script>javascript:alert('此博客已存在');</script>");
                    return View();
                }
                Directory.CreateDirectory(@"F:\Root\Files\Blog\" + path + @"\");
                System.IO.File.Copy(@"F:\Root\Files\Blog\install\zblog\install.asp", @"F:\Root\Files\Blog\" + path + @"\install.asp");
                Response.Redirect("/Files/Blog/" + path + "/install.asp");

            }
            return View();
        }
    }
}